// 相当于 Vue 里面的 mixins
const userInfo = Behavior({
  data: {
    avatarUrl: '',
    nickName: '',
  },
  methods: {
    // 获取用户信息
    async getUserInfo() {
      const res = await wx.http.get('/userInfo')
      this.setData({
        avatarUrl: res.data.avatar,
        nickName: res.data.nickName,
      })
    },
  },
})

export default userInfo
